/*
 * NumericValue.h
 *
 *  Created on: 18 juin 2011
 *      Author: Pierrick Caillon <pierrick@megami.fr>
 */

#ifndef NUMERICVALUE_H_
#define NUMERICVALUE_H_

#include "IValueTag.h"

namespace NamedBinaryTag
{

template<int size>
class NumericValueTag: public NamedBinaryTag::IValueTag
{
protected:
	void ReadData(std::istream &input, char* output)
	{
		char srcBytes[size];
		input.read(srcBytes, size);
		for (int i = 0; i < size; i++)
			output[i] = srcBytes[size - i - 1];
	}

	void WriteData(std::ostream &output, const char* input) const
	{
		char dstBytes[size];
		for (int i = 0; i < size; i++)
			dstBytes[i] = input[size - i - 1];
		output.write(dstBytes, size);
	}
};

}

#endif /* NUMERICVALUE_H_ */
